import {getTradeDetail} from '../../../Tools/HTTPOpertion.js';
Page({
  data: {
    tradeId:0,
    info:{}
  },
  onLoad: function (options) {
    this.setData({
      tradeId: options.tradeId
    });
    console.log(options.tradeId);
    this.loadData(options.tradeId);
  },
  onShow:function(){
    this.phoneLogin()
  },
  loadData: function (tradeId){
    var self = this;
    getTradeDetail({ cnd: tradeId}).then(function(res){
      self.setData({
        info:res.data
      });
      const info = res.data;
      self.info.curR = info.currency;
    }).catch(function(err){
    });
  },
  goH5: function() {
    wx.navigateTo({
        url: "/pages/h5/h5?url="+this.data.info.advertisement.url,
     })
  },
  //
  toNext: function () {
    console.log("OK");
    var self = this;
    wx.redirectTo({
      url: '../DetailsOfTheBill/DetailsOfTheBill?id=' + self.data.tradeId
    })
  },
  goBackHome: function() {
    wx.removeStorageSync('token')
    wx.switchTab({
      url: '/pages/spellGroupHome/spellGroupHome'
    });
  }
})
